package yxy.cherry.paycenter.channelmodule.sdk_huawei;

import java.util.ArrayList;

import org.joda.time.DateTime;

import com.alibaba.fastjson.JSONObject;

import yxy.cherry.data.bean.charge;
import yxy.cherry.paycenter.channelmodule.PayMoudle_channel;
import yxy.cherry.paycenter.database.db.orders;
import yxy.game.pm2.bean.Currency;
import yxy.game.pm2.bean.channel.SdkChannel;
import yxy.game.pm2.bean.module.OrderInfoModule;
import yxy.game.pm2.bean.order.OrderInfo;

public class PayMoudle_huawei extends PayMoudle_channel {
	
	@Override
	public JSONObject dealPay(JSONObject infoobj) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public JSONObject createOrderInfo(JSONObject infoobj, orders o) {
		JSONObject json = new JSONObject();
//		String orderNo, String ProductName, double Price, String ProductId
		json.put("orderNo", o.getMyorderid());
		json.put("ProductName", o.getGoodsname());
		json.put("ProductId", o.getGoodsid());
		json.put("Price", o.getGoodsprice());
		
		return json;
	}

	public orders createOrderHUAWEI(int dataid, String playercode, int serverid, int acttype) {
		orders o = createOrder(getChannel(), dataid, acttype, playercode, serverid);
		addOrder(o);
		return o;
	}
	
	/**
	 * 创建 OrderInfo
	 * @param o
	 * @param curs
	 * @param c
	 * @param payamount
	 */
	public void createOrderInfoModule(orders o, ArrayList<Currency> curs, charge c, int payamount) {
		createOrderInfoModule(o, curs, c.getVipexp(), payamount);
	}
	
	/**
	 * 
	 * @param o
	 * @param curs
	 * @param vipexp
	 * @return
	 */
	public void createOrderInfoModule(orders o, ArrayList<Currency> curs, int vipexp, int payamount) {
		OrderInfo oi = OrderInfoModule.createOrderInfo(o.getGoodsid(), o.getChannel(), o.getMyorderid(), new DateTime(o.getCreatetime().getTime()), 
				OrderInfoModule.orderinforuning, o.getPlatorderid(), o.getActtype(), o.getPlayercode(), curs, 
				o.getServerid(), DateTime.now(), vipexp, payamount, o.getGoodsprice());
		OrderInfo.set(o.getPlayercode(), oi);
	}
	
	@Override
	public String getChannel() {
		return SdkChannel.sdk_huawei;
	}

}
